Skip to content

fix: repair cross-package test failures and type errors - #101

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2155-1785429400
Open

fix: repair cross-package test failures and type errors#101
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2155-1785429400

Conversation

@stooit

@stooit stooit commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing bun test cases and tsc --noEmit errors across the monorepo. All bugs spanned package boundaries. No test files were modified and no dependencies were added.

Final state: 13 pass / 0 fail and tsc --noEmit exits clean.

Fixes

  • apps/web/src/lib/api.ts — renamed-hook import. The hook was renamed to useDebounce in packages/utils, but apps/web still imported/re-exported the old name. Updated the import and re-export as export { useDebounce as useSearchDebounce } so the public useSearchDebounce name still resolves (satisfies apps/web/test/api.test.ts).
  • bunfig.toml — test DOM environment. The root config used environment = "happy-dom", which is Vitest/Jest syntax that Bun ignores, so document was undefined and every React component test failed. Switched to Bun's [test] preload of the existing happy-dom setup so component tests get a DOM globally.
  • packages/ui/.../Button.tsx — accessible name. Now forwards an explicit aria-label to the rendered <button>, and applies a default aria-label for iconOnly buttons that don't provide one (WCAG 2.2 SC 4.1.2).
  • packages/utils/.../date.ts — locale/format. formatDate now produces a day-first DD/MM/YYYY (en-AU) string with an unpadded day and 4-digit year via Intl.DateTimeFormat.formatToParts (e.g. 15/6/2024, 1/3/2024), fixing the previous 01/03/2024 output.
  • tsconfig.json — added DOM/test lib+types so tsc --noEmit is clean.

Notes / assumptions

  • The task hinted at a DataTable "stale closure" bug. Investigation (and the passing controlled-re-render test, once the DOM env was fixed) showed the sort logic was already correct — the failure was purely the missing DOM environment. Left DataTable logic untouched.
  • The date tests only assert the day portion; the DD/MM/YYYY 4-digit-year output was chosen to match the tests' stated intent while satisfying every assertion.
  • iconOnly Button default aria-label falls back to a generic label when none is supplied.

Verification

  • bun test → 13 pass, 0 fail
  • bunx tsc --noEmit → exit 0

- restore useSearchDebounce export alias (hook renamed to useDebounce)
- preload happy-dom in root bunfig.toml so component tests have a DOM
- forward aria-label and default it for iconOnly Buttons (WCAG 4.1.2)
- format dates day-first with unpadded day and 4-digit year (en-AU)
- add DOM/test types in tsconfig so tsc --noEmit is clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant